Creates a TextConverter object for converting between two encodings. It also works if the input encoding and output encoding are the same.
Syntax |
|---|
|
result = GetTextConverter( inputEncoding, outputEncoding ) |
Parameters |
||
|---|---|---|
|
inputEncoding |
Input text encoding. |
|
|
outputEncoding |
Output text encoding. |
|
Return Value |
||
|---|---|---|
|
Result |
Object of type TextConverter, used to perform conversion from InputEncoding to OutputEncoding. |
|
Notes
In REALbasic, every string may internally have a record of its encoding as well as the bytes that constitute its actual text. In many cases, the encoding is unknown, but any string returned by a TextConverter will have a known encoding, and so will be treated properly by EditFields and Graphics.DrawString. This is why it may sometimes be useful to get a TextConverter where the input and output encodings are the same; it provides a way to make sure that REALbasic knows what encoding a string represents.
Example
The following example converts the text in an EditField:
c=GetTextConverter( GetTextEncoding( &h500), GetTextEncoding(0))
EditField2.text=c.convert(EditField1.text)
See Also
ConvertEncoding, DefineEncoding, Encoding, GetFontTextEncoding, GetInternetTextEncoding, GetTextEncoding functions; TextConverter, TextEncoding classes.